<html>
<head><meta charset="utf-8"><title>println, panic, format arguments, and the edition · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/println.2C.20panic.2C.20format.20arguments.2C.20and.20the.20edition.html">println, panic, format arguments, and the edition</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230727335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/println%2C%20panic%2C%20format%20arguments%2C%20and%20the%20edition/near/230727335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/println.2C.20panic.2C.20format.20arguments.2C.20and.20the.20edition.html#230727335">(Mar 17 2021 at 16:55)</a>:</h4>
<p>(Related to a recent thread.)</p>
<p>We have <a href="https://github.com/rust-lang/rfcs/pull/2795">RFC 2795</a> (<a href="https://github.com/rust-lang/rust/issues/67984">tracking issue</a>) to allow <code>println!("{local_variable}");</code>. We need the 2021 edition to help us apply that to <code>panic!</code>, because historically one-argument panic has worked differently (supporting an arbitrary value), and <code>panic!("{local_variable"}")</code> looks like a one-argument panic.</p>
<p>Do we want to stabilize support for this in everything <em>except</em> <code>panic!</code> in all editions, and let panic be inconsistent in Rust 2018 code? Or do we want to stabilize it only in 2021 and newer, for consistency? I've been assuming the former (stabilize in all editions), but I wanted to check that we had consensus on that.</p>



<a name="230727359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/println%2C%20panic%2C%20format%20arguments%2C%20and%20the%20edition/near/230727359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/println.2C.20panic.2C.20format.20arguments.2C.20and.20the.20edition.html#230727359">(Mar 17 2021 at 16:55)</a>:</h4>
<p>cc <span class="user-group-mention" data-user-group-id="1977">@T-lang</span></p>



<a name="230737075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/println%2C%20panic%2C%20format%20arguments%2C%20and%20the%20edition/near/230737075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/println.2C.20panic.2C.20format.20arguments.2C.20and.20the.20edition.html#230737075">(Mar 17 2021 at 17:52)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> Oh i just commented on this in the "String Interpolation" thread: <a href="#narrow/stream/213817-t-lang/topic/String.20Interpolation/near/230736367">https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/String.20Interpolation/near/230736367</a></p>
<p>I think we can just stabilize it in all editions. the cases where it'd be confusing all have a warn-by-default lint since 1.51</p>



<a name="230755558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/println%2C%20panic%2C%20format%20arguments%2C%20and%20the%20edition/near/230755558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/println.2C.20panic.2C.20format.20arguments.2C.20and.20the.20edition.html#230755558">(Mar 17 2021 at 19:51)</a>:</h4>
<p><span class="user-mention" data-user-id="310399">@Mara</span> I'm a bit confused, you're not proposing we change the semantics of older editions, are you?</p>



<a name="230755599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/println%2C%20panic%2C%20format%20arguments%2C%20and%20the%20edition/near/230755599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/println.2C.20panic.2C.20format.20arguments.2C.20and.20the.20edition.html#230755599">(Mar 17 2021 at 19:52)</a>:</h4>
<p>or just stabilize in all editions and warn on the confusing cases</p>



<a name="230755713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/println%2C%20panic%2C%20format%20arguments%2C%20and%20the%20edition/near/230755713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/println.2C.20panic.2C.20format.20arguments.2C.20and.20the.20edition.html#230755713">(Mar 17 2021 at 19:53)</a>:</h4>
<p>it doesn't change anything. we just add support for <code>format_args!("{x}")</code> on all editions. that doesn't break anything. the only thing is that it won't do anything for <code>panic!("{x}")</code>, which is confusing. but that now gives a warning, so it's not that bad.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>